package org.gap.web.jsf;

import java.util.List;

import org.gap.dao.EtablissementsBancairesDAO;
import org.gap.dao.GuichetsDAO;
import org.gap.dao.PaysDAO;

import org.gap.domain.EtablissementsBancaires;
import org.gap.domain.Guichets;
import org.gap.domain.Pays;

import org.gap.service.EtablissementsBancairesService;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.context.annotation.Scope;

import org.springframework.stereotype.Component;

import org.springframework.transaction.annotation.Transactional;

/**
 * Spring Component that handles CRUD requests for EtablissementsBancaires entities
 * 
 */
@Scope("session")
@Component("EtablissementsBancairesComponent")
public class EtablissementsBancairesComponentImpl implements
		EtablissementsBancairesComponent {

	/**
	 * Data type variable that provides CRUD operations for EtablissementsBancaires entities
	 * 
	 */
	private EtablissementsBancaires etablissementsbancaires;

	/**
	 * DAO injected by Spring that manages Pays entities
	 * 
	 */
	private Pays pays;

	/**
	 * DAO injected by Spring that manages Guichets entities
	 * 
	 */
	private Guichets guichetses;

	/**
	 * DAO injected by Spring that manages EtablissementsBancaires entities
	 * 
	 */
	@Autowired
	private EtablissementsBancairesDAO etablissementsBancairesDAO;

	/**
	 * DAO injected by Spring that manages Guichets entities
	 * 
	 */
	@Autowired
	private GuichetsDAO guichetsDAO;

	/**
	 * DAO injected by Spring that manages Pays entities
	 * 
	 */
	@Autowired
	private PaysDAO paysDAO;

	/**
	 * Service injected by Spring that provides CRUD operations for EtablissementsBancaires entities
	 * 
	 */
	@Autowired
	private EtablissementsBancairesService etablissementsBancairesService;

	/** 
	 */
	public EtablissementsBancairesComponentImpl() {
	}

	/**
	 * Getter for variable EtablissementsBancaires
	 * 
	 */
	@Transactional
	public EtablissementsBancaires getEtablissementsbancaires() {
		return etablissementsbancaires;
	}

	/**
	 * Save an existing Pays entity
	 * 
	 */
	@Transactional
	public String saveEtablissementsBancairesPays(String etablissementsbancaires_etbPays, Integer etablissementsbancaires_etbEtablissement, Pays pays) {
		etablissementsbancaires = etablissementsBancairesService.saveEtablissementsBancairesPays(etablissementsbancaires_etbPays, etablissementsbancaires_etbEtablissement, pays);

		return "/jsf/etablissementsbancaires/viewEtablissementsBancaires.xhtml";
	}

	/**
	 * Getter for variable EtablissementsBancaires
	 * 
	 */
	@Transactional
	public Pays getPays() {
		return pays;
	}

	/**
	 * Delete an existing EtablissementsBancaires entity
	 * 
	 */
	@Transactional
	public String deleteEtablissementsBancaires(String etbPaysKey, Integer etbEtablissementKey) {
		EtablissementsBancaires etablissementsbancaires = etablissementsBancairesDAO.findEtablissementsBancairesByPrimaryKey(etbPaysKey, etbEtablissementKey);
		etablissementsBancairesService.deleteEtablissementsBancaires(etablissementsbancaires);
		return "/jsf/etablissementsbancaires/listEtablissementsBancairess.xhtml";
	}

	/**
	 * Create a new Guichets entity
	 * 
	 */
	@Transactional
	public String newEtablissementsBancairesGuichetses(String etablissementsbancaires_etbPays, Integer etablissementsbancaires_etbEtablissement) {
		guichetses = new Guichets();

		return "/jsf/etablissementsbancaires/guichetses/createGuichetses.xhtml";
	}

	/**
	 * Edit an existing Guichets entity
	 * 
	 */
	@Transactional
	public String editEtablissementsBancairesGuichetses(String etablissementsbancaires_etbPays, Integer etablissementsbancaires_etbEtablissement, Integer related_guichetses_guiEtablissement, Integer related_guichetses_guiGuichet, String related_guichetses_guiPays) {
		guichetses = guichetsDAO.findGuichetsByPrimaryKey(related_guichetses_guiEtablissement, related_guichetses_guiGuichet, related_guichetses_guiPays, -1, -1);
		return "/jsf/etablissementsbancaires/guichetses/editGuichetses.xhtml";
	}

	/**
	 * Save an existing Guichets entity
	 * 
	 */
	@Transactional
	public String saveEtablissementsBancairesGuichetses(String etablissementsbancaires_etbPays, Integer etablissementsbancaires_etbEtablissement, Guichets guichets) {
		etablissementsbancaires = etablissementsBancairesService.saveEtablissementsBancairesGuichetses(etablissementsbancaires_etbPays, etablissementsbancaires_etbEtablissement, guichets);

		return "/jsf/etablissementsbancaires/viewEtablissementsBancaires.xhtml";
	}

	/**
	 * Select an existing EtablissementsBancaires entity
	 * 
	 */
	@Transactional
	public String selectEtablissementsBancaires(String etbPaysKey, Integer etbEtablissementKey) {
		etablissementsbancaires = etablissementsBancairesDAO.findEtablissementsBancairesByPrimaryKey(etbPaysKey, etbEtablissementKey);

		return "/jsf/etablissementsbancaires/viewEtablissementsBancaires.xhtml";
	}

	/**
	 * Edit an existing EtablissementsBancaires entity
	 * 
	 */
	@Transactional
	public String editEtablissementsBancaires(String etbPaysKey, Integer etbEtablissementKey) {
		etablissementsbancaires = etablissementsBancairesDAO.findEtablissementsBancairesByPrimaryKey(etbPaysKey, etbEtablissementKey);

		return "/jsf/etablissementsbancaires/editEtablissementsBancaires.xhtml";
	}

	/**
	 * Delete an existing Guichets entity
	 * 
	 */
	@Transactional
	public String deleteEtablissementsBancairesGuichetses(String etablissementsbancaires_etbPays, Integer etablissementsbancaires_etbEtablissement, Integer related_guichetses_guiEtablissement, Integer related_guichetses_guiGuichet, String related_guichetses_guiPays) {
		etablissementsbancaires = etablissementsBancairesService.deleteEtablissementsBancairesGuichetses(etablissementsbancaires_etbPays, etablissementsbancaires_etbEtablissement, related_guichetses_guiEtablissement, related_guichetses_guiGuichet, related_guichetses_guiPays);

		return "/jsf/etablissementsbancaires/viewEtablissementsBancaires.xhtml";
	}

	/**
	 * Edit an existing Pays entity
	 * 
	 */
	@Transactional
	public String editEtablissementsBancairesPays(String etablissementsbancaires_etbPays, Integer etablissementsbancaires_etbEtablissement, String related_pays_pppPays) {
		pays = paysDAO.findPaysByPrimaryKey(related_pays_pppPays, -1, -1);
		return "/jsf/etablissementsbancaires/pays/editPays.xhtml";
	}

	/**
	 * Show all EtablissementsBancaires entities
	 * 
	 */
	@Transactional
	public List<EtablissementsBancaires> listEtablissementsBancairess() {
		return new java.util.ArrayList<EtablissementsBancaires>(etablissementsBancairesService.loadEtablissementsBancairess());
	}

	/**
	 * Save an existing EtablissementsBancaires entity
	 * 
	 */
	@Transactional
	public String saveEtablissementsBancaires(EtablissementsBancaires etablissementsbancaires) {
		etablissementsBancairesService.saveEtablissementsBancaires(etablissementsbancaires);
		return "/jsf/etablissementsbancaires/listEtablissementsBancairess.xhtml";
	}

	/**
	 * Get Pays entity by EtablissementsBancaires
	 * 
	 */
	@Transactional
	public Pays getEtablissementsBancairesPays(String etbPaysKey, Integer etbEtablissementKey) {
		return etablissementsBancairesDAO.findEtablissementsBancairesByPrimaryKey(etbPaysKey, etbEtablissementKey).getPays();
	}

	/**
	 * Delete an existing Pays entity
	 * 
	 */
	@Transactional
	public String deleteEtablissementsBancairesPays(String etablissementsbancaires_etbPays, Integer etablissementsbancaires_etbEtablissement, String related_pays_pppPays) {
		etablissementsbancaires = etablissementsBancairesService.deleteEtablissementsBancairesPays(etablissementsbancaires_etbPays, etablissementsbancaires_etbEtablissement, related_pays_pppPays);

		return "/jsf/etablissementsbancaires/viewEtablissementsBancaires.xhtml";
	}

	/**
	 * View an existing Pays entity
	 * 
	 */
	@Transactional
	public String selectEtablissementsBancairesPays(String etablissementsbancaires_etbPays, Integer etablissementsbancaires_etbEtablissement, String related_pays_pppPays) {
		pays = paysDAO.findPaysByPrimaryKey(related_pays_pppPays, -1, -1);
		return "/jsf/etablissementsbancaires/pays/viewPays.xhtml";
	}

	/**
	 * Create a new EtablissementsBancaires entity
	 * 
	 */
	@Transactional
	public String newEtablissementsBancaires() {
		etablissementsbancaires = new EtablissementsBancaires();

		return "/jsf/etablissementsbancaires/createEtablissementsBancaires.xhtml";
	}

	/**
	 * Show all Guichets entities by EtablissementsBancaires
	 * 
	 */
	@Transactional
	public List<Guichets> listEtablissementsBancairesGuichetses(String etbPaysKey, Integer etbEtablissementKey) {
		return new java.util.ArrayList<Guichets>(etablissementsBancairesDAO.findEtablissementsBancairesByPrimaryKey(etbPaysKey, etbEtablissementKey).getGuichetses());
	}

	/**
	 * Create a new Pays entity
	 * 
	 */
	@Transactional
	public String newEtablissementsBancairesPays(String etablissementsbancaires_etbPays, Integer etablissementsbancaires_etbEtablissement) {
		pays = new Pays();

		return "/jsf/etablissementsbancaires/pays/createPays.xhtml";
	}

	/**
	 * Select the child Pays entity for display allowing the user to confirm that they would like to delete the entity
	 * 
	 */
	@Transactional
	public String confirmDeleteEtablissementsBancairesPays(String etablissementsbancaires_etbPays, Integer etablissementsbancaires_etbEtablissement, String related_pays_pppPays) {
		pays = paysDAO.findPaysByPrimaryKey(related_pays_pppPays);

		return "/jsf/etablissementsbancaires/pays/deletePays.xhtml";
	}

	/**
	 * View an existing Guichets entity
	 * 
	 */
	@Transactional
	public String selectEtablissementsBancairesGuichetses(String etablissementsbancaires_etbPays, Integer etablissementsbancaires_etbEtablissement, Integer related_guichetses_guiEtablissement, Integer related_guichetses_guiGuichet, String related_guichetses_guiPays) {
		guichetses = guichetsDAO.findGuichetsByPrimaryKey(related_guichetses_guiEtablissement, related_guichetses_guiGuichet, related_guichetses_guiPays, -1, -1);
		return "/jsf/etablissementsbancaires/guichetses/viewGuichetses.xhtml";
	}

	/**
	 * Select the EtablissementsBancaires entity for display allowing the user to confirm that they would like to delete the entity
	 * 
	 */
	@Transactional
	public String confirmDeleteEtablissementsBancaires(String etbPaysKey, Integer etbEtablissementKey) {
		etablissementsbancaires = etablissementsBancairesDAO.findEtablissementsBancairesByPrimaryKey(etbPaysKey, etbEtablissementKey);

		return "/jsf/etablissementsbancaires/deleteEtablissementsBancaires.xhtml";
	}

	/**
	 * Select the child Guichets entity for display allowing the user to confirm that they would like to delete the entity
	 * 
	 */
	@Transactional
	public String confirmDeleteEtablissementsBancairesGuichetses(String etablissementsbancaires_etbPays, Integer etablissementsbancaires_etbEtablissement, Integer related_guichetses_guiEtablissement, Integer related_guichetses_guiGuichet, String related_guichetses_guiPays) {
		guichetses = guichetsDAO.findGuichetsByPrimaryKey(related_guichetses_guiEtablissement, related_guichetses_guiGuichet, related_guichetses_guiPays);

		return "/jsf/etablissementsbancaires/guichetses/deleteGuichetses.xhtml";
	}

	/**
	 * Getter for variable EtablissementsBancaires
	 * 
	 */
	@Transactional
	public Guichets getGuichetses() {
		return guichetses;
	}

}
